<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>XMLHttpRequest</title>
</head>
<body>
<script>
    window.onload = () => {
        let xhr
        if (window.XMLHttpRequest){
            xhr = new XMLHttpRequest()
        }else if(window.ActiveXObject){
            xhr  = new ActiveXObject('Microsoft.XMLHTTP')
        }

        function getData() {
            xhr.open('get', 'http://iwenwiki.com/api/blueberrypai/getIndexBanner.php')
            xhr.send()
            xhr.onload =() =>{
                if(xhr.status === 200){
                    const res = JSON.parse(xhr.response)
                    console.log(res)
                }
            }
        }

        getData()
    }
</script>
</body>
</html>
